home *** CD-ROM | disk | FTP | other *** search
- ;; autoload.mut : Delayed file loading.
- ;; Autoloading files means files are not loaded until they are used. This
- ;; can result in smaller init files and faster startup times.
- ;; (autoload function-name file-name)
- ;; When function-name is called, file-name is loaded and a call is again
- ;; made to function-name. file-name MUST have redefined function-name
- ;; (or you will find your self in a infinite loop).
- ;; (autoload-with-keypress file-name)
- ;; Same as autoload but the key that called the function is redone.
- ;; file-name MUST rebind the key or you will load forever.
- ;; You would use this function over autoload when several keys are bound
- ;; to functions rebound in file-name.
- ;; Notes:
- ;; The function that calls autoload MUST be late bound else autoload
- ;; will be called every time the function is called. bind-to-key is
- ;; always later bound. For function calls use:
- ;; (floc "function-to-be-autoloaded" args) or
- ;; (floc "function-to-be-autoloaded" ()) if no args.
- ;; Autoloaded functions can take arguments - the args after fcn-name and
- ;; file-name are passed to the autoloaded function (if they are
- ;; passed to autoload: use (push-args) or push them explictly).
- ;; Examples:
- ;; (defun foo { (floc "bar" 1 "two" 3) })
- ;; (defun bar { (autoload "bar" "bar.mco" (push-args 0)) })
- ;; Whenever foo or bar is called, bar.mco will loaded and bar called.
- ;; If foo is called, bar is called with the arg list: 1 "two" 3.
- ;; C Durland
-
- (defun
- autoload (string fcn-name file-name) HIDDEN
- {
- (if (load file-name)
- (floc (fcn-name) (push-args 2))
- (msg "autoload: Could not load " file-name)
- )
- }
- autoload-with-keypress (string file-name) HIDDEN
- {
- (if (load file-name)
- (exe-key (key-pressed))
- (msg "autoload: Could not load " file-name)
- )
- }
- )
-